Release 10.1A: OpenEdge Development:
Programming Interfaces


Verifying a static temp-table against XML Schema

This code example demonstrates schema verification with a static temp-table:

/* pi-tfx-read-2.p */ 
/* Verifies XML Schema against a static temp-table. */ 
{pi-tfx-parameterVarDefs.i} 
     
DEFINE VARIABLE returnValue AS LOGICAL NO-UNDO. 
DEFINE TEMP-TABLE ttCust  
    FIELD CustNum LIKE Customer.CustNum 
    FIELD Name LIKE Customer.Name FORMAT "X(30)". 
     
ASSIGN 
    cSourceType = "FILE" 
    cFile = "ttCust.xsd" 
    lOverrideDefaultMapping = ? 
    cFieldTypeMapping = ? 
    cVerifySchemaMode = "STRICT". 
DISPLAY "Reading XML Schema..." SKIP. 
     
returnValue = TEMP-TABLE ttCust:READ-XMLSCHEMA(cSourceType, cFile, 
                                               lOverrideDefaultMapping, 
                                               cFieldTypeMapping,  
                                               cVerifySchemaMode). 
IF returnValue THEN  
    DISPLAY "Success: Temp-table definition verified against XML Schema.". 

As written, this code sample fails with the following error messages:

Because the verification mode is “STRICT”, the presence of more fields in the XML Schema than are actually defined for the temp-table causes the method to fail. The definition and the XML Schema are not an exact match. Change the verification mode to “LOOSE”, and the code completes successfully because the temp-table definition is a partial match for the XML Schema.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095